# Maintainer: George Rawlinson <grawlinson@archlinux.org>
# Contributor: Luis Martinez <luis dot martinez at tuta dot io>
# Contributor: Michal Wojdyla < micwoj9292 at gmail dot com >
# Contributor: arno <apithon.AT.free.DOT.fr>
# Contributor: Pierre Bourdon <delroth@gmail.com>
# Contributor: ianux <ianux AT free DOT fr>

pkgname=python-hachoir
pkgver=3.2.0
pkgrel=3
pkgdesc='A Python library to view and edit a binary stream field by field'
arch=('any')
url='https://hachoir.readthedocs.io/'
license=('GPL')
depends=(
  'python'
  'python-darkdetect'
)
makedepends=(
  'git'
  'python-build'
  'python-installer'
  'python-wheel'
  'python-setuptools'
  'python-urwid'
  'python-wxpython'
)
optdepends=(
  'python-urwid: required for hachoir-urwid'
  'python-wxpython: required for hachoir-wx'
)
_commit='90c624d976eb64064f370ee5a3c040535182ef49'
source=("$pkgname::git+https://github.com/vstinner/hachoir.git#commit=$_commit")
b2sums=('SKIP')

pkgver() {
  cd "$pkgname"

  git describe --tags
}

build() {
  cd "$pkgname"

  python -m build --wheel --no-isolation
}

check() {
  cd "$pkgname"

  python runtests.py
}

package() {
  cd "$pkgname"

  python -m installer --destdir="$pkgdir" dist/*.whl
}
